#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int a = 0, b = 0, c = 0, d = 0, e = 0;
    int num = 0;
    for (num = 10000; num < 100000; num++)
    {
        int i = 0, sum = 0;
        for (i = 10000; i >= 10; i /= 10)
        {
            int product = (num / i) * (num % i);
            sum += product;
        }
        if (sum == num)
            printf("%d ", num);
    }
    return 0;
}